#ifndef VERTEXDEC_H
#define VERTEXDEC_H

typedef struct
{
    float pos[3];    /* in case of morph, preblend during decode */
    float normal[3]; /* in case of morph, preblend during decode */
    float uv[2];     /* scaled by uscale, vscale, if there */
    float color[4];  /* unlit */
    float weights[8];
} DecodedVertex;

typedef struct
{
    float *v;
    float *normal;
    float *uv;
    float *c;
    float *wt;
} PtrVertex;

typedef struct
{
    float v[3];
    float normal[3];
    float uv[2];
    float c[4];
    float wt[8];
} Vertex;

typedef struct
{
    u32 fmt;
    u32 biggest;
    u8  throughmode;

    u32 weightoff;
    u32 tcoff;
    u32 coloff;
    u32 nrmoff;
    u32 posoff;
    u32 size;
    u32 oneSize;

    u32 tc;
    u32 col;
    u32 nrm;
    u32 pos;
    u32 weighttype;
    u32 idx;
    u32 morphcount;
    u32 nweights;
} VertexDecoder;

void vertexdec_setVertexType(VertexDecoder *vd, u32 fmt);
void vertex_decode(VertexDecoder *vd, PtrVertex *vert, u32 vertsAddr, u32 indsAddr, u32 cur);

#endif
